<?php

/**
* MenuModule.class.php
*
* Concrete page module responsable for creating page footer
*
* @author     Blazej Zieba <b@zieba.info>
* @copyright  2007 konekto.com
* @version    CVS: $Id:$
*/

require_once("framework/PageModule.class.php");

// {{{ MenuModule

class MenuModule extends PageModule 
{
    // {{{ Class operations 

    // {{{ getContent

    /**
    * Function returns page content
    *
    */

    function getContent()
    {


        $options = &PEAR::getStaticProperty('CONFIG_INI','TEMPLATES'); 
        $global = &PEAR::getStaticProperty('CONFIG_INI','GLOBAL'); 

        $tpl = new HTML_Template_IT($options["templates_dir"]);
        $tpl->loadTemplatefile("menu.tpl.xhtml",true,true);

        if       ( $_REQUEST["cmd"] == "GuideList" || !strlen($_REQUEST["cmd"]) )
        {

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');            
        }
        elseif  (  $_REQUEST["cmd"] == "ShowRoute" && is_numeric( $_REQUEST["id"] )  )
        {

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=GuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');


            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Przegląd trasy")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "ShowSlide" && is_numeric( $_REQUEST["id"] ) && is_numeric( $_REQUEST["guide_id"] ) )
        {
            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=GuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Przegląd")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=ShowRoute&id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');


            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Opis lokalizacji")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "Twitter" )
        {

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Powrót")) ;
            $cmd = $_REQUEST["refcmd"] == 'Twitter' ? '' :  $_REQUEST["refcmd"];
            $tpl->setVariable("LINK", $global['service_url'].'/?cmd='.$cmd.'&id='.$_REQUEST["id"].'&guide_id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        return $tpl->get();
    }
    
    // }}}

    // }}}
}

// }}} 

?>
